<template>
	<view class="content">
		<!-- <view class="form-content">
			<view class="form-ctrl">时间范围：</view>
			<picker mode="date" class="form-ctrl" fields="day" :end="end" :value="workTimeStart" @change="bindStart">
				<view class="uni-input">{{workTimeStart}} -</view>
			</picker>
			<picker mode="date" class="form-ctrl" fields="day" :start="workTimeStart" :end="end" :value="workTimeEnd"
				@change="bindEnd">
				<view class="uni-input">{{workTimeEnd}}</view>
			</picker>
			<view class="iconfont icon-gengduo1 arrow"></view>
		</view> -->
		<view class="info-block">
			<template v-if="infoList.length>0">
				<view class="info-item" v-for="(item,index) in infoList" :key="item.id"
					@click="navigate('/pages/supervise/superintendent-secretary?id='+item.id+'&startTime='+workTimeStart+'&endTime='+workTimeEnd)">
					<view class="name-block">
						<view class="name">{{item.duties}}:{{item.name}}</view>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</template>
			<view v-else style="text-align: center;">暂无数据</view>
		</view>
	</view>
</template>

<script>
	import {
		getListByPidApi
	} from '@/api/supervise.js'
	import {
		getCurrentTime,
		getPickerIndex
	} from '@/util/util';
	export default {
		data() {
			return {
				infoList: [],
				id: null,
				end: getCurrentTime('d'),
				workTimeStart: '开始日期',
				workTimeEnd: '结束日期',
			}
		},
		methods: {
			navigate(url) {
				uni.navigateTo({
					url
				})
			},
			search() {
				this.getList()
			},
			// bindStart(e) {
			// 	this.workTimeStart = e.detail.value
			// 	if (this.workTimeEnd != '结束日期') {
			// 		this.getList()
			// 	}
			// },
			// bindEnd(e) {
			// 	this.workTimeEnd = e.detail.value
			// 	if (this.workTimeStart != '开始日期') {
			// 		this.getList()
			// 	}
			// },
			getList() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getListByPidApi({
					id: this.id,
					startTime: this.workTimeStart == '开始日期' ? '' : this.workTimeStart,
					endTime: this.workTimeEnd == '结束日期' ? '' : this.workTimeEnd,
				}).then(res => {
					uni.hideLoading()
					this.infoList = res.list || []
				}).catch(() => {
					uni.hideLoading()
				})
			},

		},
		onLoad(e) {
			this.id = e.id
			this.getList()
		},
		onShow() {
			this.workTimeStart = '开始日期',
				this.workTimeEnd = '结束日期'
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		background: #F5F5F5;
		width: 100%;
		min-height: 100vh;
		padding: 30rpx;

		.form-content {
			display: flex;
			flex-direction: row;
			justify-content: center;
			margin-bottom: 20rpx;

			.form-ctrl {
				margin-left: 10rpx;
				font-size: 30rpx;
				color: #999;
			}
		}


		.info-block {
			display: flex;
			flex-direction: column;
			height: auto;
			position: relative;

			.info-item {
				min-height: 140rpx;
				height: auto;
				box-shadow: 0 0 10px 0 #dedede;
				background: #fff;
				display: flex;
				flex-direction: column;
				justify-content: center;
				border-radius: 20rpx;
				padding: 30rpx;
				margin-bottom: 30rpx;

				.name-block {
					width: 100%;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;

					.name {
						font-weight: bold;
						font-size: 34rpx;
					}

					.iconfont {
						color: #CBCBCB;
						width: 100rpx;
						display: flex;
						justify-content: flex-end;
					}
				}

				.title-item {
					width: 100%;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;
					margin-top: 20rpx;

					.name {
						width: 100%;
						font-weight: bold;
						font-size: 30rpx;
					}

					.time {
						font-size: 28rpx;
						color: $uni-color-primary;
					}
				}


				.time-item.fewer {
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 1;
					overflow: hidden;
					display: none;
				}

				.time-item {
					background: #F8F8F8;
					margin-top: 20rpx;
					padding: 20rpx;
					border-radius: 20rpx;

					.one {
						position: relative;
						padding-bottom: 10rpx;

						.onedot {
							left: -2rpx;
							width: 24rpx;
							height: 24rpx;
							position: absolute;
							//background-color: #4C7FE2;
							border: 1px solid #4C7FE2;
							border-radius: 50%;
							display: flex;
							justify-content: center;
							align-items: center;
							z-index: 1;
						}

						.oneline {
							position: absolute;
							left: 10rpx;
							height: calc(100% - 24rpx);
							border-left: 1px solid #1254F1;
							margin-top: 24rpx;
						}

						.onemain {
							position: relative;
							padding-left: 56rpx;
							top: -6rpx;
						}

						.onemaintitle {
							margin-bottom: 16rpx;
							padding-top: 8rpx;
							line-height: 1;
							font-size: 28rpx;
							color: #303133;
						}

						.onemaincon {
							color: #303133;
							background-color: #DFE8F9;
							padding: 20rpx;
							font-size: 28rpx;
							line-height: 60rpx;
						}
					}
				}
			}
		}
	}
</style>